import React from 'react'

function Title(props) {
    return (
        <div className="title">
            <h1>title</h1>
            {props.children}
        </div>
    );
}

class Log extends React.Component {
    constructor() {
        super()
        this.state = {
            nums: [1,2,3]
        }
    }

    handleEvent = (name) => {
        console.log('name',name)
        console.log('click one', this)
    }

    render() {
        return (
            <Title>
                {
                    this.state.nums.map((num) => 
                        <button key={num} onClick={() => this.handleEvent(num.toString())}>
                            click{num}
                        </button>
                    )
                }
            </Title>
        );
    }
}

export default Log;